# placebo tests of fake cutoffs
migbw2 <- rdd_reg_lm(migbw, bw = 14)
ecobw2 <- rdd_reg_lm(ecobw, bw = 14)
culbw2 <- rdd_reg_lm(culbw, bw = 14)

placmig <- plotPlacebo(migbw2, from = 0.1, to = 0.9, by = 20, same_bw = TRUE)
placeco <- plotPlacebo(ecobw2, from = 0.1, to = 0.9, by = 20, same_bw = TRUE)
placcul <- plotPlacebo(culbw2, from = 0.1, to = 0.9, by = 20, same_bw = TRUE)


# manual fake cutoffs

## cutoff at median of control group
findmedian <- ESS10 %>% 
  filter(date < 0)
median <- median(findmedian$date)

rd_mig30 <- RDestimate(mig ~ date | cntry, data = ESS10, cutpoint = median, bw = 14, se.type = "HC1")
summary(rd_mig30)
rd_eco30 <- RDestimate(eco ~ date | cntry, data = ESS10, cutpoint = median, bw = 14, se.type = "HC1")
summary(rd_eco30)
rd_cul30 <- RDestimate(cul ~ date | cntry, data = ESS10, cutpoint = median, bw = 14, se.type = "HC1")
summary(rd_cul30)

## 10, 20, 40, 50 days before event
rd_mig10 <- RDestimate(mig ~ date | cntry, data = ESS10, cutpoint = -10, bw = 14, se.type = "HC1")
summary(rd_mig10)
rd_eco10 <- RDestimate(eco ~ date | cntry, data = ESS10, cutpoint = -10, bw = 14, se.type = "HC1")
summary(rd_eco10)
rd_cul10 <- RDestimate(cul ~ date | cntry, data = ESS10, cutpoint = -10, bw = 14, se.type = "HC1")
summary(rd_cul10)

rd_mig20 <- RDestimate(mig ~ date | cntry, data = ESS10, cutpoint = -20, bw = 14, se.type = "HC1")
summary(rd_mig20)
rd_eco20 <- RDestimate(eco ~ date | cntry, data = ESS10, cutpoint = -20, bw = 14, se.type = "HC1")
summary(rd_eco20)
rd_cul20 <- RDestimate(cul ~ date | cntry, data = ESS10, cutpoint = -20, bw = 14, se.type = "HC1")
summary(rd_cul20)

rd_mig40 <- RDestimate(mig ~ date | cntry, data = ESS10, cutpoint = -40, bw = 14, se.type = "HC1")
summary(rd_mig40)
rd_eco40 <- RDestimate(eco ~ date | cntry, data = ESS10, cutpoint = -40, bw = 14, se.type = "HC1")
summary(rd_eco40)
rd_cul40 <- RDestimate(cul ~ date | cntry, data = ESS10, cutpoint = -40, bw = 14, se.type = "HC1")
summary(rd_cul40)

rd_mig50 <- RDestimate(mig ~ date | cntry, data = ESS10, cutpoint = -50, bw = 14, se.type = "HC1")
summary(rd_mig50)
rd_eco50 <- RDestimate(eco ~ date | cntry, data = ESS10, cutpoint = -50, bw = 14, se.type = "HC1")
summary(rd_eco50)
rd_cul50 <- RDestimate(cul ~ date | cntry, data = ESS10, cutpoint = -50, bw = 14, se.type = "HC1")
summary(rd_cul50)


